
package villa.tools.mq.views;

import villa.tools.mq.preferences.MensajesSave;
import villa.tools.mq.preferences.Propiedades;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IViewSite;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.part.ViewPart;

public class MqToolView extends ViewPart {
	
	PrincipalView principal = null;
	
	public static void main(String[] a) {
	    Display d = Display.getDefault();
	    Shell s = new Shell(d);
	    FillLayout fl = new FillLayout();
	    fl.type = SWT.HORIZONTAL;
	    s.setText("MQ Tools");
	    s.setLayout(fl);
	    Composite general = new Composite(s, SWT.NONE);
	    FormLayout layout = new FormLayout();
		layout.marginWidth = 0;
		layout.marginHeight = 0;
		general.setLayout(layout);
	    general.setToolTipText("general");
	    
	    PrincipalApp prin = new PrincipalApp(general,d);
	    
        
	    s.open();
	    while (!s.isDisposed()) {
	      if (!d.readAndDispatch())
	        d.sleep();
	    }
	    d.dispose();
	  }
	
	
	/**
	 * The constructor.
	 */
	public MqToolView() {
		Propiedades.getInstancia().PropiedadesUsers();
		MensajesSave.getInstancia().PropiedadesUsers();
		PrincipalView.getInstancia().setView(this);
		
	}

	/**
	 * Init
	 * 
	 * @param site Site
	 */
	public void init(IViewSite site) throws PartInitException {
		super.init(site);
		//Activator.getDefault().getPreferenceStore().addPropertyChangeListener(propertyChangeListener);
	}

	/**
	 * Dispose
	 */
	public void dispose() {
		super.dispose();
		//Activator.getDefault().getPreferenceStore().removePropertyChangeListener(propertyChangeListener);
	}

	/**
	 * This is a callback that will allow us
	 * to create the viewer and initialize it.
	 */
	public void createPartControl(Composite parent) {
		PrincipalView.getInstancia().init(parent);
	}

	/**
	 * Passing the focus request to the viewer's control.
	 */
	public void setFocus() {
	}

}